<?php

class Avatar_Widget_ProfilePhotoController extends Engine_Content_Widget_Abstract
{
  public function indexAction()
  {
    // Don't render this if not authorized
    $viewer = Engine_Api::_()->user()->getViewer();
    if( !Engine_Api::_()->core()->hasSubject() ) {
      return $this->setNoRender();
    }
    $authorization = Engine_Api::_()->authorization();
    $this->view->web_cam_on = $authorization->getPermission($viewer->level_id, 'avatar', 'web_cam');
    $this->view->avatar_collection_on = $authorization->getPermission($viewer->level_id, 'avatar', 'avatarcollection');
    // Get subject and check auth
    $subject = Engine_Api::_()->core()->getSubject('user');
    
    $this->view->user = $subject;
  }
}